package com.greenleaf.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.greenleaf.dao.ShoppingCateDao;
import com.greenleaf.dao.VipDao;
import com.greenleaf.entity.SearchCon;
import com.greenleaf.entity.Vip;
import com.greenleaf.service.VipService;
@Service("vipService")
public class VipServiceImpl implements VipService {
@Resource
	private VipDao vipDao;
@Resource
	private ShoppingCateDao shoppingCateDao;
	@Override
	public List<Vip> getAllVip(SearchCon searchCon) {
		return vipDao.getAllVip(searchCon);
	}
	/**
	 * 查询所有管理员总数
	 */
	@Override
	public int getTotalVip(SearchCon searchCon) {
		return vipDao.getTotalVip(searchCon);
	}
	@Override
	public int addVip(Vip vip) {
		 vipDao.addVip(vip);
		 return shoppingCateDao.addShoppingCate(vip.getvId());
	}
	@Override
	public int updateVip(Vip vip) {
		return vipDao.updateVip(vip);
	}
	@Override
	public int delVip(int vipId) {
		shoppingCateDao.addShoppingCate(vipId);
		return vipDao.delVip(vipId);
	}
	@Override
	public List<Vip> login(Vip vip) {
		return vipDao.login(vip);
	}
}
